using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CreateRT : MonoBehaviour
{
    public RawImage rawImage;
    public Camera camera;
    // Start is called before the first frame update
    void Start()
    {
        SetCameraRT();
    }

    // Update is called once per frame
    void Update()
    {

    }

    void SetCameraRT()
    {
        var rect = rawImage.rectTransform.rect;
        RenderTexture texture = new RenderTexture((int)rect.width, (int)rect.height,0);
        camera.targetTexture = texture;
        rawImage.texture = texture;
    }
}
